package net.xinqushi.common;

public class RightShift {

    public static void main(String[] args) {

        int posValue = 7;
        int negValue = -1;
        System.out.println(posValue >> 2);
        System.out.println(posValue >>> 2);
        System.out.println(posValue << 1);
        System.out.println(posValue << 1);
        System.out.println(negValue >>> 3);// 无符号移位只对负数有影响,相比较与有符号移动
        System.out.println((negValue >>> 3) << 3);

        System.out.println(Integer.toBinaryString(negValue));
        System.out.println(Integer.toBinaryString(negValue >>> 3));
        System.out.println(Integer.toBinaryString((negValue >>> 3) << 3));
    }
}
